$( document ).on( "pageshow", "#myIntegralDetail", function( event ) {
	access_token=getQueryString("access_token");
	type=getParameterByName("type",event.target.baseURI);
	pageNo="1";
	pageSize="10";
	$("#wrapper_myIntegralDetail  #pullDown").hide();
	
	var scrollObj_myIntegralDetail=scrollPlugLoadedOfReturn("wrapper_myIntegralDetail",
			function() {
				setTimeout(function () {
					if(pageNo >= totalPage)
						return;
					pageNo++;
					loadData_Integral_Detail(false,type,scrollObj_myIntegralDetail);
				}, 1000);	
			},
			function() {
//				setTimeout(function () {
//					pageNo=1;
//					loadData_redFlowerRank(true);
//				}, 1000);
				scrollObj_myIntegralDetail.refresh();
			});
	
	loadData_Integral_Detail(true,type,scrollObj_myIntegralDetail);
});

/**
 * 
 * @param isFresh 是否刷新
 * @param isFresh 是否是分页加载数据
 */
function loadData_Integral_Detail(isFresh,type,scrollObj_myIntegralDetail){
	$.ajax({
	  	url: rootPath+"/ingegral/getAddIntegralInfo.do",
	  	type: "POST",
	  	dataType: "text",
		data: "access_token="+access_token+"&pageNo="+pageNo+"&pageSize="+pageSize+"&type="+type,
	  	success: function( response ) {
	  		var data=$.parseJSON(response);
	  		
			if(data.state=="200"){
				totalPage=data.data.totalPage;
		  		var totalRow=data.data.totalRow;
		  		var arr=data.data.rows;
				var content = "";
				for (var i=0;i<arr.length;i++){
					var game = arr[i].integralType=="5"?"幸运大转盘":"谁是红花王";
					content+="<li data-icon=\"false\">"+
			  					"<a href=\"#\">"+
									"<p>我在&nbsp;<b>#"+game+"#</b>&nbsp;得到积分<span style='color:#db3911;'>"+arr[i].integralNum+"</span>分</p>"+
									"<p style='margin-top:10px;'>"+arr[i].createTimeStr+"</p>"+
			 					 "</a>"+
							  "</li>";
				}
				if(arr.length<pageSize){
					$("#wrapper_myIntegralDetail  #pullUp").hide();
				}else{
					$("#wrapper_myIntegralDetail  #pullUp").show();
				}
				if(isFresh && $("#thelist_myIntegralDetail").html()!=""){
					$("#thelist_myIntegralDetail").html("");
				}
				$("#thelist_myIntegralDetail").append(content).listview('refresh');
				
				scrollObj_myIntegralDetail.refresh();
				
			}else{
				alert_wx('fail',data.msg);
			}
	  	}
	});
}

